package forward.Util;

public class TimerUtil {
	private long lastMS;

	private long getCurrentMS() {
		return System.nanoTime() / 1000000L;
	}

	public boolean hasReached(double milliseconds) {
		if ((double) (this.getCurrentMS() - this.lastMS) >= milliseconds) {
			return true;
		}
		return false;
	}

	public void reset() {
		this.lastMS = this.getCurrentMS();
	}

	public boolean delay(float milliSec) {
		if ((float) (this.getTime() - this.lastMS) >= milliSec) {
			return true;
		}
		return false;
	}

	public long getTime() {
		return System.nanoTime() / 1000000L;
	}
	public final boolean hasPassed(long milliseconds) {
		return this.getCurrentMS() - this.lastMS > milliseconds;
	}
	public final long getDifference() {
		return this.getCurrentMS() - this.lastMS;
	}
}
